import java.util.Arrays;

public class Test {
    public static void selectSort(int[] arr) {
        for (int i = 0; i < arr.length-1; i++) {
            int left = i;
            int minIndex = left;
            for (int j = i; j < arr.length; j++) {
                if (arr[j] < arr[minIndex]) {
                    minIndex = j;
                }
            }
            swap(arr,left,minIndex);
        }
    }
    private static void swap(int[] arr, int i, int j) {
        int tmp = arr[i];
        arr[i] = arr[j];
        arr[j] = tmp;
    }

    public static void main(String[] args) {
        int[] arr = {23,122,0,12,5657,12,48,-14,2,7,2,19,24,26,10,88,66,16};
        selectSort(arr);
        System.out.println(Arrays.toString(arr));
    }
}